<template>
	<view>
		<view class="">
			<!-- 2.0.19支持autoBack，默认为false -->
			<u-navbar leftText="消息" autoBack>
			</u-navbar>
		</view>
		<view class="con-body">
			<view class="list_con u-flex" v-for="(item,index) in list" :key="index" @click="intoComment(item.gid)">
				<image :src="item.avatar"></image>
				<view class="con_l">
					<view class="con_name">{{item.username}}</view>
					<view class="con_c overflow">{{item.content}}</view>
					<view class="con_time">{{item.time}}</view>
				</view>
			</view>
		</view>
		<u-empty :show="showEmpty" mode="data" icon="http://cdn.uviewui.com/uview/empty/data.png">
		</u-empty>
	</view>
</template>

<script>
	import {
		getUnReadDetail
	} from "@/service/communitService.js";
	export default {
		data() {
			return {
				showEmpty:false,
				list:[]
			}
		},
		onLoad() {
			getUnReadDetail().then(this.getUnReadDetail);
		},
		methods: {
			getUnReadDetail(e){
				if(e.code==200){
					this.list=e.result;
					this.showEmpty=false
				}else{
					this.list=e.result;
					this.showEmpty=false
				}
			},
			intoComment(id) {
				this.$u.route({
					url: '/pagesCommunity/index/comment',
					type: 'redirectTo',
					params: {
						id: id
					}
				});
			},
		}
	}
</script>

<style lang="scss">
	.list_con{
		padding:20rpx;
		border-bottom:1rpx solid #f2f2f2;
		image{
			width:100rpx;
			height:100rpx;
			border:10rpx;
		}
		.con_l{
			width:80%;
			padding-left:15rpx;
			font-size: 30rpx; 
			.con_name{
				font-size: 26rpx;
				color:#0B868E;
				overflow: hidden;
			}
			.con_c{
				padding:10rpx 0;
			}
			.con_time{
				font-size: 22rpx;
				color:#aaa;
			}
		}
	}
</style>
